package com.zhuiwei.initialization;

/**
 * 可以变参数列表
 * object类型之外的参数列表
 * @author zhuiwei
 * @see 《java编程思想 第四版》5.8.1
 */


public class VarargType {

  static void f(Character... args) {
    System.out.print(args.getClass());
    System.out.println(" length " + args.length);
  }

  static void g(int... args) {
    System.out.print(args.getClass());
    System.out.println(" length " + args.length);
  }

  public static void main(String[] args) {
    f('a');
    f();
    g(1);
    g();
    System.out.println("int[]: " + new int[0].getClass());
  }
}

/*
输出结果:
class [Ljava.lang.Character; length 1
class [Ljava.lang.Character; length 0
class [I length 1
class [I length 0
int[]: class [I
*/
